<template>
	<view class="page" :style="{'min-height':h+'px','padding-top':(mt+10)+'px'}">
		<image class="bg_img" src="https://i.ringzle.com/file/20240129/3931d06eaa3346c9955aa7e5e535a95b.png"
			mode="widthFix"></image>
		<c-nav-bar title="其他功能" bgColor="transparent" :showHome="false"></c-nav-bar>
		<view class="box">
			<view class="title">便民服务</view>
			<view class="cards">
				<view v-for="(item,index) in serviceMenus" :key="index" @tap="toTurn(item.path,item.login)">
					<image :src="item.img"></image>
					<text>{{item.text}}</text>
				</view>
			</view>
		</view>
		<view class="box">
			<view class="title">其他</view>
			<view class="cards">
				<view v-for="(item,index) in otherMenus" :key="index" @tap="toTurn(item.path,item.login)">
					<image :src="item.img"></image>
					<text>{{item.text}}</text>
				</view>
			</view>
		</view>
		<GetPhoneNumber ref="phoneNumber" @loginSuccess="loginSuccess"></GetPhoneNumber>
	</view>
</template>

<script>
	import GetPhoneNumber from '@/compoments/Getphonenumber/index.vue'
	export default {
		components: {
			GetPhoneNumber
		},
		data() {
			return {
				h: uni.getSystemInfoSync().windowHeight,
				mt: uni.getSystemInfoSync().statusBarHeight + 44,
				serviceMenus: [{
						img: 'https://i.ringzle.com/file/20240129/21a10c6fc5174c6c862b811e95e6cecd.png',
						text: '社区互动',
						path: '/pagesService/CouncilSquare/CouncilSquare?name=社区互动',
						login: false
					},
					{
						img: 'https://i.ringzle.com/file/20240129/d72fd1b5d2f84f58a76b2eed5de8f7bf.png',
						text: '议事广场',
						path: '/pagesService/CouncilSquare/CouncilSquare?name=议事广场',
						login: false
					},
					{
						img: 'https://i.ringzle.com/file/20240129/e788900c29934b27aed887663225292a.png',
						text: '家政服务',
						path: '/pagesService/CouncilSquare/Housekeeping',
						login: false
					},
					{
						img: 'https://i.ringzle.com/file/20240129/8b8d5f0ce50746db91dc8c8d343aa07e.png',
						text: '小工市场',
						path: '/pagesService/market/market?name=小工市场',
						login: false
					},
					{
						img: 'https://i.ringzle.com/file/20240129/ead1f1a952af484c9a9bb280969a1fcb.png',
						text: '志愿活动',
						path: '/pagesService/funActivity/service?name=志愿活动',
						login: false
					},
					{
						img: 'https://i.ringzle.com/file/20240129/e33b18ee9e2443c8961028391c35df05.png',
						text: '文化休闲',
						path: '/pagesService/CouncilSquare/CouncilSquare?name=文化休闲',
						login: false
					},
					{
						img: 'https://i.ringzle.com/file/20240129/37d83aeb2b4549edb26d0c13880cd040.png',
						text: '兴趣课程',
						path: '/pagesService/CouncilSquare/CouncilSquare?name=兴趣课程',
						login: false
					},
					{
						img: 'https://i.ringzle.com/file/20240129/c33fb542e82442d09639bece2419053b.png',
						text: '资讯信息',
						path: '/pagesService/news/news?name=资讯信息',
						login: false
					}
				],
				otherMenus: [{
						img: 'https://i.ringzle.com/file/20240129/42dbfbaf22a74d899f16f1afa57d6f30.png',
						text: '旅拍',
						path: '/pages/index/travelBooking/index',
						login: false
					},
					// {
					// 	img:'https://i.ringzle.com/file/20240129/6348cc9408684cce8b1353dfe132f236.png',
					// 	text:'导游预订',
					// 	path:'/pages/index/guide/index',
					// 	login:false
					// },
					{
						img: 'https://i.ringzle.com/file/20240129/4893264be4384ee1a879a5a577adb362.png',
						text: '停车服务',
						path: '/pagesIndex/parkingService/index',
						login: false
					},
					// {
					// 	img:'https://i.ringzle.com/file/20240129/6348cc9408684cce8b1353dfe132f236.png',
					// 	text:'导游订单',
					// 	path:'/pagesMy/guideServe/guideServe',
					// 	login:true
					// },
					{
						img: 'https://i.ringzle.com/file/20240129/4893264be4384ee1a879a5a577adb362.png',
						text: '停车记录',
						path: '/pagesIndex/parkingService/parkingRecord',
						login: true
					}
				]
			}
		},
		methods: {
			toTurn(url, login) { //login 是否需要验证登录跳转
				if (!url) return this.$showToast('正在开发中...');
				if (login) {
					this.$login().then(res => {
						if (res === 0) {
							uni.navigateTo({
								url
							});
						} else this.$refs['phoneNumber'].show = true;
					})
				} else {
					uni.navigateTo({
						url
					});
				}
			},
		}
	}
</script>

<style scoped lang="less">
	.page {
		background: #F5F8FA;
		box-sizing: border-box;

		.bg_img {
			width: 100%;
			position: absolute;
			top: 0;
			left: 0;
			z-index: 0;
		}

		.box {
			width: calc(100% - 40rpx);
			margin: 20rpx 20rpx 0;
			padding: 40rpx 10rpx;
			box-sizing: border-box;
			background: #FFFFFF;
			border-radius: 20rpx;
			position: relative;

			.title {
				font-size: 36rpx;
				font-family: PingFang-SC, PingFang-SC;
				font-weight: bold;
				color: #1C1E41;
				line-height: 36rpx;
				padding-left: 10rpx;
			}

			.cards {
				width: 100%;
				margin-top: 8rpx;
				display: flex;
				flex-wrap: wrap;

				&>view {
					width: 25%;
					display: flex;
					flex-direction: column;
					align-items: center;
					margin-top: 40rpx;

					image {
						width: 48rpx;
						height: 48rpx;
					}

					text {
						font-size: 26rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						color: #333333;
						line-height: 26rpx;
						margin-top: 24rpx;
					}
				}
			}
		}
	}
</style>